<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Appoint extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'eb_appoint';
    protected $guarded=[];

    public static $stateTxt = [
        0 => '待审核',
        1 => '进行中',
        2 => '已完成',
        3 => '已取消',
        4 => '已过期',
        5 => '待确认（加号）',
        6 => '排队中',
        7 => '预约失败'
    ];

    public static $sourceTxt = [
        1=>'用户预约',
        2=>'社区加号',
    ];

    public function family()
    {
        return $this->hasOne(Family::class,'id','family_id');
    }

    public function user()
    {
        return $this->hasOne(User::class,'id','user_id');
    }

    public function appointType(){
        return $this->hasOne(HospitalAppointType::class,'id','type');
    }
    public function vaccine(){
        return $this->hasOne(Vaccine::class,'id','project');
    }
    public function hospital(){
        return $this->hasOne(Hospital::class,'id','hospital_id');
    }
    public function interval(){
        return $this->hasOne(HospitalAppointInterval::class,'id','appoint_time');
    }
    public function month(){
        return $this->hasOne(FamilyType::class,'id','project');

    }

    public function project(){

    }
}
